home *** CD-ROM | disk | FTP | other *** search
- global dataSource, handlerStore
-
- on setContent
- numPages = dataSource.xmlData["disc"]["pages"].child.count
- numSections = dataSource.xmlData["disc"]["sections"].child.count
- if numPages > 1 then
- repeat with pageNum = 1 to dataSource.xmlData["disc"]["pages"].count
- if dataSource.xmlData["disc"]["pages"].child[pageNum].attributeValue["name"] = "sections" then
- sectionsPage = pageNum
- end if
- end repeat
- if sectionsPage <> 1 then
- repeat with pageNum = 1 to sectionsPage - 1
- currentPage = dataSource.xmlData["disc"]["pages"].child[pageNum]
- sprite("Content pane").setSection(currentPage.attributeValue["name"])
- end repeat
- end if
- setSections(sectionsPage)
- if sectionsPage < numPages then
- repeat with pageNum = sectionsPage + 1 to numPages
- sprite("Content pane").setSection(dataSource.xmlData["disc"]["pages"].child[pageNum].attributeValue["name"])
- end repeat
- end if
- else
- sectionsPage = 1
- setSections(sectionsPage)
- end if
- repeat with sectionNum = 1 to numSections
- numEntries = dataSource.xmlData["disc"]["sections"].child[sectionNum]["entries"].child.count
- repeat with entryNum = 1 to numEntries
- currentEntry = dataSource.xmlData["disc"]["sections"].child[sectionNum]["entries"].child[entryNum]
- if currentEntry["shorttitle"] <> VOID then
- listTitle = currentEntry["shorttitle"].child[1].toString()
- else
- listTitle = currentEntry["title"].child[1].toString()
- end if
- actualSectionNum = sectionsPage + sectionNum - 1
- sprite("Content pane").setApp(actualSectionNum, listTitle)
- descText = removeOuterTags(currentEntry.toString())
- sprite("Content pane").setAppAttribute(sectionNum, entryNum, "description", descText)
- numLinks = currentEntry["links"].child.count
- repeat with linkNum = 1 to numLinks
- setLink(sectionNum, entryNum, linkNum, currentEntry["links"].child[linkNum])
- end repeat
- if currentEntry["footer"]["column1"] <> VOID then
- column1Text = removeOuterTags(currentEntry.toString())
- sprite("Content pane").setAppAttribute(sectionNum, entryNum, "column1", column1Text)
- if currentEntry["footer"]["column2"] <> VOID then
- column2Text = removeOuterTags(currentEntry.toString())
- sprite("Content pane").setAppAttribute(sectionNum, entryNum, "column2", column2Text)
- end if
- end if
- end repeat
- end repeat
- end
-
- on setSections sectionsPage
- numSections = dataSource.xmlData["disc"]["sections"].child.count
- repeat with pageNum = 1 to numSections
- currentSection = dataSource.xmlData["disc"]["sections"].child[pageNum]
- sprite("Content pane").setSection(currentSection.attributeValue["name"])
- if currentSection["intro"] <> VOID then
- setSectionIntro(sectionsPage + pageNum - 1, currentSection)
- end if
- end repeat
- end
-
- on setSectionIntro secNum, section
- introDesc = removeOuterTags(section["intro"]["main"])
- if section["intro"]["footer"] <> VOID then
- footerDesc = removeOuterTags(section["intro"]["footer"].toString())
- else
- footerDesc = VOID
- end if
- highlights = findNodesWithAttr(section["entries"], "highlight", "true")
- if highlights.count <> 0 then
- setHighlights(secNum, highlights)
- end if
- updates = findNodesWithAttr(section["entries"], "updated", "true")
- if updates.count <> 0 then
- setUpdates(secNum, updates)
- end if
- end
-
- on setHighlights secNum, highlights
- repeat with hlNum = 1 to highlights.count
- if highlights[hlNum].node["shorttitle"] <> VOID then
- hlTitle = highlights[hlNum].node["shorttitle"].child[1].toString()
- else
- hlTitle = highlights[hlNum].node["title"].child[1].toString()
- end if
- hlDesc = removeOuterTags(highlights[hlNum].node["highlight"].toString())
- hlImage = getVolume() & highlights[hlNum].node["highlight"].attributeValue["src"]
- sprite("Content pane").setHighlight(secNum, hlNum, hlTitle, hlDesc, hlImage, highlights[hlNum].childNum)
- end repeat
- end
-
- on setUpdates secNum, updates
- repeat with updNum = 1 to updates.count
- sprite("Content pane").setUpdate(secNum, updates[updNum].childNum, updates[updNum].node["title"].child[1].toString())
- end repeat
- end
-
- on findNodesWithAttr parentNode, attrName, attrValue
- matchingNodes = []
- repeat with childNum = 1 to parentNode.child.count
- currentNode = parentNode.child[childNum]
- if currentNode.attributeValue[attrName] = attrValue then
- matchingNodes.add([#node: currentNode, #childNum: childNum])
- end if
- end repeat
- return matchingNodes
- end
-
- on assembleHTMLText parentNode
- htmlText = EMPTY
- repeat with childNum = 1 to parentNode.child.count
- htmlText = htmlText & parentNode.child[childNum].toString()
- end repeat
- return htmlText
- end
-
- on setLink sectionNum, entryNum, linkNum, currentLink
- if currentLink.child.count <> 0 then
- sprite("Content pane").setComplexLink(sectionNum, entryNum, linkNum, currentLink.attributeValue["label"])
- repeat with stepNum = 1 to currentLink.child.count
- stepDesc = removeOuterTags(currentLink.child[stepNum].toString())
- stepLabel = currentLink.child[stepNum].attributeValue["label"]
- stepTarget = currentLink.child[stepNum].attributeValue["href"]
- sprite("Content pane").setStep(sectionNum, entryNum, linkNum, stepDesc, stepLabel, stepTarget)
- end repeat
- else
- sprite("Content pane").setSimpleLink(sectionNum, entryNum, currentLink.attributeValue["label"], currentLink.attributeValue["href"])
- end if
- end
-